package cc.mrbird.febs.buss.util;

import javax.annotation.Resources;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Properties;

public class ConfigResourceUtil {
    public static String getConfigByName(String name){
        Properties prop = new Properties();
        try{
            //读取属性文件a.properties
            InputStream in = Resources.class.getResourceAsStream("/web_config.properties");
            //InputStream in = new BufferedInputStream(new FileInputStream("/WEB-INF/classes/web_config.properties"));
            prop.load(in);     ///加载属性列表
            /*Iterator<String> it=prop.stringPropertyNames().iterator();
            while(it.hasNext()){
                String key=it.next();
                System.out.println(key+":"+prop.getProperty(key));
            }*/
            in.close();
            ///保存属性到b.properties文件

            return prop.getProperty(name);
        }
        catch(Exception e){
            System.out.println(e);
        }
        return null;
    }
}
